home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / aplverb.tex < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.9 KB  |  46 lines

  1. %        aplverb.tex = verbatim.tex
  2. %
  3. %
  4. %    F|ljande macron anv{nds d} man vill f} ut \TeX-kommandon
  5. %    i klartext.  @text@ ger text i fonten \tt med alla kontroll-
  6. %    tecken och dylika bevarade (\TeX\ f|rst}r sig endast p} kommandot
  7. %    @ i denna mode). Man kan ocks} utnyttja \begintt ... \endtt f|r
  8. %    att beskriva kommandon, d} {r ocks} \obeylines och \obeyspaces
  9. %    aktiva. Om man vill anv{nda vissa \TeX-kommandon men vill
  10. %    ocks} displaya n}got i en-kolumn-tabell-form kan man anv{nda
  11. %    \begindisplay ...\cr ...\cr \enddisplay
  12. %           Om du vill anv{nda \begintt...\endtt f|r text som inte
  13. %       ryms p} en sida, kan du ocks} anv{nda \beginlines...\endlines.
  14. %       Varje rad m}ste d} b|rjas och avslutas med kommandot @.
  15. \newskip\verbatimindent \verbatimindent=0cm
  16. \newskip\ttglue{\tt \global\ttglue=.5em plus.25em minus.15em}
  17. \def\@{\char'100 }
  18. %
  19. \outer\def\begindisplay{\obeylines\startdisplay}
  20. {\obeylines\gdef\startdisplay#1
  21.     {\catcode`\^^M=5$$#1\halign\bgroup&\hskip\verbatimindent##\hfil\cr}}
  22. \outer\def\enddisplay{\crcr\egroup$$}
  23. %
  24. \chardef\other=12
  25. \def\ttverbatim{\begingroup \catcode`\\=\other \catcode`\{=\other
  26.     \catcode`\}=\other \catcode`\$=\other \catcode`\&=\other
  27.     \catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
  28.     \catcode`\_=\other \catcode`\^=\other\catcode`\*=\other\catcode`\==\other
  29.     \obeyspaces \obeylines \tt}
  30. {\obeyspaces\gdef {\ }}
  31. %
  32. \def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=0pt
  33.     \catcode`\@=0 \parindent=\verbatimindent \rightskip=-5pc \ttfinish}
  34. {\catcode`\@=0 @catcode`@\=\other % @ is temporary escape character
  35.     @obeylines % end of line is active
  36.     @gdef@ttfinish#1^^M#2\endtt{#1@vbox{#2}@endgroup$$}}
  37. %
  38. \catcode`\@=\active
  39. {\obeylines\gdef@{\ttverbatim\spaceskip=\ttglue\let^^M=\ \let@=\endgroup}}
  40.  
  41. \def\beginlines{\par\begingroup\nobreak\medskip\parindent=0pt
  42.    \kern1pt\nobreak \obeylines \everypar{\strut}}
  43. \def\endlines{\kern1pt\endgroup\medbreak\noindent}
  44.  
  45. \endinput
  46.